<script setup>
import { wjakblsd } from "@/api/pannel/production_pannel.js";
import { formatMoney } from "@/utils/globalMethod";

const key = ref(1);
const fullall = inject("fullall");
const config = reactive({
  header: [
    "行",
    "状态",
    "来源单号",
    "工单单号",
    "客户编号",
    "生产进度",
    "产品编号",
    "产品名称",
    "产品型号",
    "领料进度",
    "工单数量",
  ],
  data: [],
  index: false,
  align: [
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
    "center",
  ],
  columnWidth: [40, 80, 120, 120, 100, 550, 160, 160, 160, 80, 80],
  headerBGC: "rgba(0,0,0,0)",
  oddRowBGC: "rgba(0,0,0,0)",
  evenRowBGC: "rgba(0,0,0,0)",
  rowNum: 10,
});

const loadData = async () => {
  const { data } = await wjakblsd({
    FromDevice:'Visual',
    data: ["19910101", "20991230"],
    BillStatus: 0,
  });
  config.data = data.map((item, index) => {
    return [
      index + 1,
      item.zt,
      item.FromNO,
      item.gddh,
      item.CustomerID,
      item.scjd,
      item.cpbh,
      item.cpmc,
      item.cpgg,
      item.lljd,
      (item.gdsl = formatMoney(null, item.gdsl)),
    ];
  });
};

watch(
  () => fullall,
  () => {
    setTimeout(() => {
      nextTick(() => {
        key.value++;
      });
    }, 300);
  },
  {
    deep: true,
  }
);

const keyResize = () => {
  nextTick(() => {
    setTimeout(() => {
      key.value++;
    }, 100);
  });
};

onMounted(loadData);
// onMounted(() => {
//   window.addEventListener('resize', keyResize)
// })

// onUnmounted(() => {
//   window.removeEventListener('resize', keyResize)
// })
</script>

<template>
  <div class="ps_w_h_100">
    <dv-border-box8 :key="key">
      <dv-scroll-board :config="config"></dv-scroll-board>
    </dv-border-box8>
  </div>
</template>

<style scoped lang="scss"></style>
